In order to transfer a packet over a network, the packet data is passed from a user space of an operating system to a kernel space of the operating system. The data is handled and generated by a user or a computer application in the user space of the operating system. Network stacks usually reside within the kernel space of the operating system. A connection over a network is established and managed by the network hardware running the network stacks. A kernel routine runs in the network stack, each time data is passed downstream from the user space to the kernel space of the operating system. To process data in order to prepare it for sending over a network, a context switch from the user space to the kernel space is performed. For receiving data, a context switch from the kernel space to the user space is performed. These context switches are realized using system calls. A kernel routine associated with the respective system call is executed each time a system call is issued. A number of processing and validity checks are performed before the data is sent by the network hardware, e.g. via user datagram protocol (UDP). Every operation needed for preparing data to be transferred over the network hardware requires the intervention of the central processing unit (CPU) and therefore, blocks the CPU for a certain time. Thus, the network hardware causes a significant CPU payload.
FIG. 1 shows data handling according to an operating system 2. Data are available in a memory 14 in the form of data blocks 12, which are referenced by IO vectors. An IO vector is a pointer to a data block 12 of an application in addition to the length thereof. A system call 10 is used for passing a data block 12 from the user space 4 of an operating system 2 to the kernel space 6 of the operating system 2. In the kernel space 6, the data is prepared for being sent over the network by the network hardware 8. For each data block 12 to be passed to the kernel space 6, a separate system call 10 is needed. For example, the ‘sendmsg’ system call may be used for this purpose. The size of a data block 12 to be passed from the user space 4 to the kernel space 6 is limited by the size of an IP packet, (e.g. 64 kiloBytes (kB)). As the maximum transmission unit of the network hardware 8 is much lower, fragmentation of these data blocks 12 in the kernel space 6 is needed.
A known solution to reduce the processor overhead of context switches caused by system call execution is to accumulate small parts of data to be sent in a buffer and pass the accumulated data to the kernel within one system call. The number of system calls is thereby reduced as more data is passed from the user space to the kernel space within one system call and thus, the number of context switches is reduced. The system call uses an IO-vector structure to pass the accumulated fragments of data. A limitation of this solution is that the data fragments passed within one IO-vector to the kernel space must not exceed the size of one packet that can be sent over the network. The size of one packet that can be sent over the network is known as maximum transmission unit (MTU). In case of an UDP/IP packet, the MTU is 65535 Bytes (64 kB). Therefore, the amount of data passed to the kernel networking stack in case of UDP/IP within one system call is limited to 64 kB. In the case of other networking protocols, different MTUs exist. For example, the MTU of EthernetV2 is 1.5 kB and the MTU of Fast Ethernet using jumbo frames is up to 9 kB.
A well known system call in the Linux operating system used for the purpose of passing data from the user space to the kernel space is the ‘sendmsg’ system call. The kernel copies all the data to be passed with the system call from the user space into newly allocated buffers within the kernel space. This copy process is very CPU intensive. By way example, in the case a 10 Gbit networking system, the copying process using the ‘sendmsg’ system call is too slow and causes unsatisfactory performance. Aside from the data copying, other protocol computations are performed on the same CPU. This leads to serious payload and performance degradation of a computer in the case where a 10 Gbit networking hardware is operated.
A known solution is the use of the so called zero copy functionality based on the direct memory access (DMA) functionality of the computer hardware. For example, the system call ‘sendfile’ uses DMA. However, the usage of the ‘sendfile’ system call is restricted to data already stored within the kernel space or accessible via a file structure. A zero copy mechanism for user space data, (e.g. within the 10GE driver from Chelsio) “TCP Zero-Copy in the Chelsio T3 Family 10/1 Gb Ethernet driver (2008 Apr. 14), Chelsio Communications, Inc. 370 San Aleso Ave. Sunnyvale, Calif. 94085”, already exists. However, a zero copy process for user defined transport protocols or unreliable transports (over UDP/IP) is necessary.
US2007/0223483 shows a communication endpoint processor that acts as an interface between computational and communication domains. Multiple frames of multiple sizes are collected and are passed from a user space of an operating system to a kernel space. The processor interrupts transmissions of lower priority frames in order to send higher priority frames. Passing data from the user space to the kernel space within one system call is restricted to a predetermined maximum size.
JP2001005767 shows a method to reduce the overall overhead caused by system calls while passing data, which are sent over a network interface, from the user space to the kernel space of an operating system.